package jy.game.components.event.triggers;


import java.util.List;
import java.util.UUID;

import jy.game.BasePojo;
import jy.game.JyCondition;
import wx.xml.simpleframework.xml.Attribute;
import wx.xml.simpleframework.xml.Element;
import wx.xml.simpleframework.xml.ElementList;
import wx.xml.simpleframework.xml.Root;

@Root(name = "trigger")
public class JyGlobalTrigger extends BasePojo {

    @Attribute public                       String            story;
    @ElementList(name = "condition", inline = true) public List<JyCondition> conditions;
    private                                 String            _pk;

    //        public static JyGlobalTrigger GetCurrentTrigger() {
//            if (RuntimeData.Instance.HasFlag(CommonSettings.flagNoGlobalEvent)) {
//                return null;
//            }
//            for (Object object: JyResourceManager.getAll("JyGlobalTrigger")) {
//                JyGlobalTrigger globalTrigger = (JyGlobalTrigger)object;
//                if (!RuntimeData.Instance.keyValues.containsKey(globalTrigger.story)) {
//                    boolean  flag = true;
//                    for (JyCondition condition:globalTrigger.conditions) {
//                        if (!TriggerLogic.judge(condition)) {
//                            flag = false;
//                            break;
//                        }
//                    }
//                    if (flag) {
//                        return globalTrigger;
//                    }
//                }
//            }
//            return null;
//        }


    public JyGlobalTrigger() {
        this._pk = UUID.randomUUID().toString();
    }

    // (get) Token: 0x060003E1 RID: 993 RVA: 0x000041A1 File Offset: 0x000023A1
    @Override public /*override*/ String getPK() {
        {
            return this._pk;
        }
    }
}
